export default {
  inserted(el, bindings) {
    el.onmousedown = function(e) {
      var disx = e.pageX - el.offsetLeft
      var disy = e.pageY - el.offsetTop
      document.onmousemove = function(e) {
        el.style.left = e.pageX - disx + 'px'
        el.style.top = e.pageY - disy + 'px'
      }
      console.log(e.pageX, e.pageY)
      document.onmouseup = function() {
        document.onmousemove = document.onmouseup = null
      }
    }
  }
}
